package main

import (
	"github.com/davecgh/go-spew/spew"
	"reflect"
	"unsafe"
)

//go:linkname growslice runtime.growslice
//goland:noinspection GoUnusedParameter
func growslice(et *GoType, old GoSlice, cap int) GoSlice

// runtime.go
func UnpackType(t reflect.Type) *GoType {
	return (*GoType)((*GoEface)(unsafe.Pointer(&t)).Value)
}

func main() {

	var typeByte = UnpackType(reflect.TypeOf(byte(0)))

	spew.Dump(typeByte)

	dest := make([]byte, 0, 10)

	spew.Dump(dest)

	ds := (*GoSlice)(unsafe.Pointer(&dest))
	*ds = growslice(typeByte, *ds, 100)

	spew.Dump(ds)
}
